<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <div id="app">
        是否显示下列内容： <input type="text" v-model="flag"><br>
        <div v-show="flag=='是'">
            <div>{{num}}</div>
            请输入一个数字： <input type="text" v-model.number="num"><br>
            <div>{{num1}}+{{num2}}={{num1+num2}}</div>
            <button type="submit" @click="Addnum1">+1</button>
            <button type="reset" @click="Addnum2(num)">+{{num}}</button>
        </div>
    </div>
    <script>
        const { createApp } = Vue
        createApp({
            data() {
                return {
                    num: 2,
                    num1: 0,
                    num2: 0,
                    flag: true
                }
            },
            methods: {
                Addnum1() {
                    this.num1++
                },
                Addnum2(num) {
                    this.num2 += num
                }
            }
        }).mount('#app')
    </script>
</body>

</html>